#pragma once

#include <Blobz.h>
#include <BlobzGui.h>
#include "Graphics/3D/ColladaScene.h"
#include "FingerManager.h"

namespace Tutorial6
{
	/* A simple tutorial showing how to load a collada 3d object and also use shaders */
	class TutorApp6 : public Blobz::BaseApplication, Blobz::Interactable
	{
	public:
		TutorApp6();
		~TutorApp6();

	public:
		virtual bool onInitialize();
		virtual void onDeinitialize();

		virtual void onReload();

		virtual void onUpdate(float inFrameTime);
		virtual void onDraw();

		virtual void onFingerDown(const  TouchListener::TouchData& inData);
		virtual void onFingerUp(const  TouchListener::TouchData& inData);
		virtual void onFingerUpdate(const  TouchListener::TouchData& inData);

		virtual void onFingerExit(const  TouchListener::TouchData& inData);

	private:
		void renderBackground();

	private:
		Blobz::Texture mBackgroundTexture;
		Blobz::ColladaScene *mpModel;
		Blobz::CgShaderMain mShaderManager;
		Blobz::Node *mpRootNode;
		Blobz::Material *mpMaterial;
		Blobz::LightNode* mpLightNode;
		Blobz::Node* mpLightNodeInverse;
		Blobz::Node* mpObjectNode;

		float mDistance;
		float mMaxDistance;
		float mZoomSensitivity;
		float mMinZoomDistance;
		float mSpinSensitivity;

		QVector2D mLastPos;
		FingerManager mFingerManager;

	};
}
